package Test;

import java.util.Random;

public class Test7 {
    public static void main(String[] args) {
        int[] arr = {100, 2, 3000, 40000, 500};
        int[] nerArr = new int[arr.length];
        Random r = new Random();
        for (int i = 0; i < arr.length;) {
            int a = r.nextInt(5);
            int b = arr[a];
            if(!choujiang(nerArr,b)){
                nerArr[i] = arr[a];
                i++;
            }
        }
        for (int i = 0; i < nerArr.length; i++) {
            System.out.println(nerArr[i]);
        }
    }
    public static boolean choujiang(int[] arr,int a){
        for (int i = 0; i < arr.length; i++) {
            if (arr[i] == a){
                return true;
            }
        }
        return false;
    }
}
